#!/bin/bash -e 
source reporting.sh

REPORT=/tmp/report.txt
LOCAL_REPORT=report/report.txt
CONFIG=/config/device/module_config.json
LOG=/tmp/nmap.log
RESULT_LINES=/tmp/result_lines.txt

TEST_NAME="connection.mac_oui"
TEST_DESCRIPTION="Check Physical device address OUI against IEEE registration and verify it is registered with the correct manufacturer"
REDACTED_LOG=/tmp/macoui.report.log

echo Using the host hardware address $TARGET_MAC | tee -a $REDACTED_LOG

java -jar mac_oui/build/libs/mac_oui-all.jar $TARGET_MAC

RESULT_AND_SUMMARY="$(grep "RESULT" $LOCAL_REPORT)"
grep -v "RESULT" $LOCAL_REPORT >> $REDACTED_LOG

# For testing module timeout.
sleep 10

TEST_RESULT=$(cat $REDACTED_LOG)

write_out_result $REPORT \
                 "$TEST_NAME" \
                 "$TEST_DESCRIPTION" \
                 "$TEST_RESULT" \
                 "$RESULT_AND_SUMMARY"
